<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.beaut.project.util.FlowUtility" %>
<%@ include file="/public/header.jsp"%>

<html>
	<head>
	</head>
	<script type="text/javascript">
		var xmStatus = new Array("新建","未开工", "在建", "完工", "验收", "送审", "开票" ,"结算", "关闭"); 
		$(function(){
			$("#table").datagrid({
				title:"项目收支情况",
				iconCls:'icon-edit',
				loadMsg:'正在加载数据，请稍后......',
				url:'<%=contextPath %>/springMVC/xm/listPageFinanceInfo',
				rownumbers:true,
				fitColumns:true,
				singleSelect:true,
				nowrap:false,
				idField:'id',
				frozenColumns:[[
				    {title:'主键',field:'id',hidden:true},
					{title:'项目进度',field:'xm_progress_status_desc',width:100,align:'center',formatter:function(value,rowData,rowIndex){
					    return xmStatus[rowData.xm_progress_status];
					}},
					{title:'所属部门',field:'admin_dept',width:100,align:'center'},
					{title:'项目编号',field:'xm_code',width:100,align:'center'},
					{title:'项目名称',field:'xm_name',width:200,align:'center'}
				]],
				columns:[
					[
						{title:'收入',width:400,align:'center',colspan:4},
						{title:'支出',width:1400,align:'center',colspan:14},
						{title:'毛利',field:'earn_money',width:100,align:'center',rowspan:4}
					],
					[
						{title:'已开票',field:'out_invoice',width:100,align:'center',rowspan:3},
						{title:'应收',field:'account_receivable',width:100,align:'center',rowspan:3},
						{title:'实收',field:'has_receivable',width:100,align:'center',rowspan:3},
						{title:'质保金',field:'warranty_value',width:100,align:'center',rowspan:3,formatter:function(value,rowData,rowIndex){
						    if(isNaN(value)){
								rowData.warranty_value=0;
							}
							return rowData.warranty_value;
						}},
						{title:'管理费',field:'xm_manage_price',width:100,align:'center',rowspan:3},
						{title:'税金',field:'company_tax',width:100,align:'center',rowspan:3},
						{title:'直接报账额',field:'direct_reimburse',width:100,align:'center',rowspan:3},
						{title:'借款报账',width:200,align:'center',colspan:2},
						{title:'分包费',width:600,align:'center',colspan:6},
						{title:'采购费',width:300,align:'center',colspan:3}
						
					],
					[
						{title:'借款总额',field:'loan_total',width:100,align:'center',rowspan:2},
						{title:'借款报账额',field:'loan_reimburs',width:100,align:'center',rowspan:2},
						{title:'已收票',field:'work_in_invoice',width:100,align:'center',rowspan:2},
						{title:'应付',field:'work_account_payable',width:100,align:'center',rowspan:2},
						{title:'实付',width:300,align:'center',colspan:3},
						{title:'扣款',field:'work_cut_pay',width:100,align:'center',rowspan:2},
						{title:'已收票',field:'purchase_in_invoice',width:100,align:'center',rowspan:2},
						{title:'应付',field:'purchase_account_payable',width:100,align:'center',rowspan:2},
						{title:'已付',field:'purchase_has_payable',width:100,align:'center',rowspan:2}
					],
					[
						{title:'进度支付',field:'finance_out8',width:100,align:'center',formatter:function(value,rowData,rowIndex){
						
								rowData.step_pay=parseFloat(rowData.work_has_payable)-parseFloat(rowData.work_end_pay);
						
							return rowData.step_pay;
						}},
						
						{title:'垫款',field:'lend_account_receivable',width:100,align:'center'},
						{title:'结算支付',field:'work_end_pay',width:100,align:'center'}
					]
				],
				pageSize:10,
				pageList : [10,50,100],  
				pagination:true,
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
		});
	</script>
	<body style="height: 97%">
		<div id="table" data-options="fit:true"></div>
	</body>
</html>
